package com.example.mqrabbit.myspring.mvc;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by SOAL on 2017/6/23 0023.
 */

//@RunWith(SpringRunner.class)
@ContextConfiguration("classpath:application-rabbitmq.xml")
public class MyTest {

    @Autowired
    private RmqProducer rmqProducer;

    @Test
    public void test() throws IOException
    {
        String exchange="testExchange";////交换器
        String routeKey="testQueue";//队列
        String methodName="test";//调用的方法
        //参数
        Map<String,Object> param=new HashMap<String, Object>();
        param.put("data","hello");

        RabbitMessage  msg=new RabbitMessage(exchange,routeKey, methodName, param);
        //发送消息
        rmqProducer.sendMessage(msg);

    }

}
